//
//  MingXiCell.m
//  Cxzc
//
//  Created by hwd on 17/8/7.
//  Copyright © 2017年 张露杰. All rights reserved.
//
//充值状态(0=待支付，1=已完成，2=已退款)
#define CZStatusArr @[@"待支付",@"已完成",@"已退款",@"",@""]
#import "MingXiCell.h"

@interface MingXiCell ()

@property (nonatomic,strong)UIView *baseView;//底层View
@property (nonatomic,strong)UILabel *titleLab;//标题
@property (nonatomic,strong)UILabel *moneyLab;//钱
@property (nonatomic,strong)UILabel *timeLab;//时间
@property (nonatomic,strong)UILabel *statusLab;//状态lab


@end

@implementation MingXiCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {//先加载父类
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = backColor;
        [self CreatUI];
    }
    return self;
}
-(void)CreatUI
{
    if (!_baseView) {//不存在加载视图
        _baseView = [[UIView alloc]initWithFrame:CGRectMake(10*screenW_6,10*screenW_6, SCREENW-20*screenW_6,75*screenW_6)];
        _baseView.backgroundColor = [UIColor whiteColor];
        [_baseView.layer setCornerRadius:5*screenW_6];
        _baseView.layer.masksToBounds = YES;
        [self addSubview:_baseView];
        
        //标题
        _titleLab = [TomamaUI createLabel:CGRectMake(20*screenW_6,10*screenW_6, SCREENW/2-30*screenW_6,25*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:17*screenW_6] textColor:TextGray text:@""];
        [_baseView addSubview:_titleLab];
        
        //充值钱数
        _moneyLab = [TomamaUI createLabel:CGRectMake(SCREENW/2-10*screenW_6,10*screenW_6, SCREENW/2-40*screenW_6,30*screenW_6) textAligment:2 font:[UIFont systemFontOfSize:17*screenW_6] textColor:[UIColor colorWithHexString:@"#f04C35"] text:@"￥0.00"];
        [_baseView addSubview:_moneyLab];
        
        //时间
        _timeLab = [TomamaUI createLabel:CGRectMake(20*screenW_6, CGRectGetMaxY(_titleLab.frame)+5*screenW_6 , SCREENW/2-30*screenW_6,25*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:15*screenW_6] textColor:[UIColor colorWithHexString:@"#999999"] text:@""];
        [_baseView addSubview:_timeLab];
        
        //状态Lab
        _statusLab = [TomamaUI createLabel:CGRectMake(SCREENW/2-10*screenW_6,CGRectGetMaxY(_titleLab.frame)+5*screenW_6, SCREENW/2-40*screenW_6,25*screenW_6) textAligment:2 font:[UIFont systemFontOfSize:14*screenW_6] textColor:[UIColor colorWithHexString:@"#999999"] text:@""];
        _statusLab.hidden = YES;
        [_baseView addSubview:_statusLab];

    }
}
//加载数据
-(void)LoadDataDic:(NSDictionary *)dataDic WithType:(NSInteger)typeNumber
{
    _titleLab.text  = @"充值";
//    _titleLab.text = [NSString stringWithFormat:@"%@%.2f元",[[ToolViewVC getNotNullStr:@"99"] isEqual:@"0"]?@"行程消费":@"提现",[[ToolViewVC getNotNullStr:@"88"] doubleValue]];
    _moneyLab.text = [NSString stringWithFormat:@"￥ %.2f",[[ToolViewVC getNotNullStr:@"90"] doubleValue]];
    _timeLab.text = @"2017-10-26 10:00";
    
//    _titleLab.text = [NSString stringWithFormat:@"%@%.2f元",[[ToolViewVC getNotNullStr:dataDic[@"moneyStatus"]] isEqual:@"0"]?@"行程消费":@"提现",[[ToolViewVC getNotNullStr:dataDic[@"money"]] doubleValue]];
//    _moneyLab.text = [NSString stringWithFormat:@"￥ %.2f",[[ToolViewVC getNotNullStr:dataDic[@"money"]] doubleValue]];
//    _timeLab.text = [NSString stringWithFormat:@"%@",[ToolViewVC getNotNullStr:dataDic[@"createDate"]]];
//    if (typeNumber == 1) {//0 消费记录
//        _titleLab.text = @"充值";
//        _statusLab.hidden = NO;
////      充值状态(0=待支付，1=已完成，2=已退款)
//        if ([dataDic[@"payStatus"] integerValue] == 2) {//已退款
//            _statusLab.text = [NSString stringWithFormat:@"已退款¥%.2f",[dataDic[@"refundMoney"] doubleValue]];
//        }else//0=待支付，1=已完成
//        {
//            _statusLab.text = [NSString stringWithFormat:@"%@",CZStatusArr[[dataDic[@"payStatus"] integerValue]]];
//        }
//    }else//1 充值记录
//    {
//        _statusLab.hidden = YES;
//    }
}
@end
